package com.dfbz.springboot_project.entity;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "role_privilege", schema = "netctoss")
public class RolePrivilege {
    private Integer roleId;
    private Integer privilegeId;

    @Id
    @Column(name = "role_id", nullable = false)
    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    @Id
    @Column(name = "privilege_id", nullable = false)
    public Integer getPrivilegeId() {
        return privilegeId;
    }

    public void setPrivilegeId(Integer privilegeId) {
        this.privilegeId = privilegeId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RolePrivilege that = (RolePrivilege) o;
        return roleId == that.roleId &&
                privilegeId == that.privilegeId;
    }

    @Override
    public int hashCode() {
        return Objects.hash(roleId, privilegeId);
    }
}
